public class Constructor01 {
    public static void main(String[] args) {
        Person P1 = new Person("小代",22);
        Person P2 = new Person("小阳");
        System.out.println("P1的名字是" + P1.name);
        System.out.println("P1的年龄是" + P1.age);
        System.out.println("P2的名字是" + P2.name);
    }
}

class Person{
    String name;
    int age;

    //第一个构造器
    public Person(String Pname,int Page){
        System.out.println("构造器被调用");
        name = Pname;
        age = Page;
    }
    //第二个构造器
    public Person(String Pname){
        System.out.println("构造器被调用");
        name = Pname;
    }
}